package cn.gemiman.daoyi.module.iot.dal.mysql.userequipmentplace;

import cn.gemiman.daoyi.framework.common.pojo.PageResult;
import cn.gemiman.daoyi.framework.mybatis.core.mapper.BaseMapperX;
import cn.gemiman.daoyi.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.gemiman.daoyi.module.iot.controller.admin.userequipmentplace.vo.UserEquipmentPlacePageReqVO;
import cn.gemiman.daoyi.module.iot.dal.dataobject.userequipmentplace.UserEquipmentPlaceDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 会员设备场所 Mapper
 *
 * @author 道一源码
 */
@Mapper
public interface UserEquipmentPlaceMapper extends BaseMapperX<UserEquipmentPlaceDO> {

    default PageResult<UserEquipmentPlaceDO> selectPage(UserEquipmentPlacePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<UserEquipmentPlaceDO>()
                .likeIfPresent(UserEquipmentPlaceDO::getEquipmentPlaceName, reqVO.getEquipmentPlaceName())
                .eqIfPresent(UserEquipmentPlaceDO::getMemberUserId, reqVO.getMemberUserId())
                .betweenIfPresent(UserEquipmentPlaceDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(UserEquipmentPlaceDO::getId));
    }

}
